/**
 * Created by Administrator on 2015/2/1.
 */
"use strict";
var app = angular.module("app",['ngRoute', 'ngAnimate','ui.bootstrap','mgo-angular-wizard','app.directives','app.authenticationservice']);
    //添加拦截
    app.config(["$httpProvider",function($httpProvider){
        //alert($httpProvider.defaults.headers.common['X-Requested-With']);
        //删除AngularJS默认的X-Request-With头
        delete $httpProvider.defaults.headers.common['X-Requested-With'];
        //为所有GET请求设置DO NOT TRACK
        //$httpProvider.defaults.headers.get['DNT'] = '1';
        $httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
        $httpProvider.defaults.headers.common['Content-Type'] = 'application/x-www-form-urlencoded';
        $httpProvider.defaults.headers.put['Content-Type']  = 'application/x-www-form-urlencoded';
        $httpProvider.interceptors.push('HttpResponseInterceptor');
        $httpProvider.defaults.transformRequest = function(data){
            if (data === undefined) {return data;}
            return $.param(data);
        }
    }]);
    app.config(["$routeProvider",function($routeProvider){
        return $routeProvider
            .when("/",{templateUrl:'login/loginui',controller:LoginController})
            .when('/login/loginui',{templateUrl:'login/loginui',controller:LoginController})
            .otherwise({redirectTo:"login/loginui",controller:LoginController});
    }]);
    app.controller("AppCtrl", ["$scope", "$location",
        function($scope, $location) {
            return $scope.isSpecificPage = function() {
                var path = $location.path();
                return path = $location.path(), _.contains(["/404", "/pages/500", "login/loginui", "/pages/signin", "/pages/signin1", "/pages/signin2", "/pages/signup", "/pages/signup1", "/pages/signup2", "/pages/lock-screen"], path)
            }, $scope.main = {
                brand: "V1.0",
                name: "Lisa Doe"
            }
        }
    ]);
//拦截
/*
app.factory('httpInterceptor',function($q,  notifyService,  errorLog)  { 
    return  function(promise)  {
        return  promise.then(
            function(response)  { 
                alert(response);
                console.log("========= Do  nothing return  response; =");
            }
            ,function(response)  { 
                 console.log("==========");
                 return  $q.reject(response); 
            });}});*/
